//
//  QSVisitProblemCell.m
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/4/13.
//  Copyright © 2020 DingC. All rights reserved.
//

#import "QSVisitProblemCell.h"

@implementation QSVisitProblemCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(QSVisitProblemModel *)model{
    _model = model;
    self.problemTtitleLabel.text = model.title;
    self.problemTtitleLabel.font = [UIFont systemFontOfSize:11 weight:1];
    self.stateLabel.text = model.stateStr;
    self.submitPeopleLabel.text = [NSString stringWithFormat:@"%@-%@", model.createRoleName, model.createAdminName];
    self.stateLabel.layer.cornerRadius = 2;
    self.stateLabel.layer.masksToBounds = YES;
    if (model.state.integerValue == 1) {
        //待处理
        NSString *submitStr = [NSDate dateWithTimestamp:model.createTime format:@"yyyy-MM-dd HH:mm"];
        self.submitLabel.text = submitStr;
        self.stateLabel.backgroundColor = [UIColor colorWithRed:255.0f / 255.0f  green:245.0f / 255.0f blue:233.0f / 255.0f alpha:1];
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#FC9F28"];
        self.sendTimeLabel.hidden = YES;
        self.dealNameLabel.hidden = YES;
    }
    if (model.state.integerValue == 2) {
        //处理中
        self.stateLabel.backgroundColor = [UIColor colorWithRed:255.0f / 255.0f  green:237.0f / 255.0f blue:233.0f / 255.0f alpha:1];
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#FF5224"];
        
        NSString *sendTimeStr = [NSDate dateWithTimestamp:model.dealTime format:@"yyyy-MM-dd HH:mm"];
        self.sendTimeLabel.text = [NSString stringWithFormat:@"分派时间：%@", sendTimeStr];
        self.submitLabel.hidden = YES;
    }
    if (model.state.integerValue == 3) {
        //不处理
        NSString *submitStr = [NSDate dateWithTimestamp:model.createTime format:@"yyyy-MM-dd HH:mm"];
        self.submitLabel.text = submitStr;

        self.stateLabel.backgroundColor = [UIColor colorWithRed:196.0f / 255.0f  green:234.0f / 255.0f blue:220.0f / 255.0f alpha:1];
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#27BA85"];
        self.sendTimeLabel.hidden = YES;
        self.dealNameLabel.hidden = YES;
    }
    if (model.state.integerValue == 4) {
//        已办结
        self.stateLabel.backgroundColor = [UIColor colorWithRed:196.0f / 255.0f  green:234.0f / 255.0f blue:220.0f / 255.0f alpha:1];
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#27BA85"];
        NSString *sendTimeStr = [NSDate dateWithTimestamp:model.dealTime format:@"yyyy-MM-dd HH:mm"];
        self.sendTimeLabel.text = [NSString stringWithFormat:@"办结时间：%@", sendTimeStr];
        self.submitLabel.hidden = YES;
    }
    self.dealNameLabel.text = [NSString stringWithFormat:@"处理单位：%@", model.departmentName];
}


@end
